	.ORIG x3000
	LD R6, STACK
	LEA R4, GLOBALS
	ADD R6, R6, #-3 ;	ADD R5, R6, #2

	LEA R0, MSG
	PUTS
	GETC
	STR R0, R5, #0	; integer = input 
AND R0, R0, #0
	ADD R0, R0, #1
	STR R0, R5, #-1	; i = 1
	
	AND R0, R0, #0
	ADD R0, R0, #1
	STR R0, R5, #-2	; j = 1

LOOPTOP	LDR R1, R5, #-1	; R0 = integer
	LDR R0, R5, #0	; R1 = i
	OUT
	NOT R0, R0
	ADD R0, R0, #1
	ADD R0, R0, R1	; i <= integer (i - integer)

	BRp DONE








DONE	HALT

STACK	.FILL x4000
GLOBALS	.FILL #0
MSG	.STRINGZ "Enter an integer: "
	.END
